import router from './index.js'
import store from '@/store'
router.beforeEach(function (to, from, next) {
  if (to.path.startsWith('/user')) {
    if (store.state.tokenInfo.token) {
      next()
    } else {
      next({
        path: '/login',
        query: {
          backto: to.fullPath
        }
      })
    }
  } else {
    next()
  }
})
export default router
